package someTestExcemple.thread;

//多线程实现方式1:将一个类声明为 Thread 的子类。该子类应重写类 Thread 的 run 方法。然后可以分配并启动子类的实例
public class MyThread extends Thread{
    long minPrime;
    MyThread(long minPrime,String name) {
        super("MyThread-"+ name); //为线程取名字
        this.minPrime = minPrime;
    }

    @Override
    public void run() {
        System.out.println("currentThread" + Thread.currentThread().getName());
        //线程要执行的任务
        // compute primes larger than minPrime
        for(int i = 0; i < minPrime; i++) {
            System.out.println("MyThread-run--" +(i+1) +"----");
        }

    }

}
